﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Practices.Unity.InterceptionExtension;

namespace Thallo.Extention {
    class ServiceFactoryProxy:ICallHandler, IDisposable {

        public IMethodReturn Invoke(IMethodInvocation input, GetNextHandlerDelegate getNext) {
            var result = getNext().Invoke(input, getNext);
            if( Thallo.Configuration.ThalloSection.Current.Enable)
                result.ReturnValue = Interceptor.Current.Builder.Wrap(result.ReturnValue);
            return result;
        }

        public int Order {
            get;
            set;
        }

        public void Dispose() {
            
        }
    }
}
